local class = reload("class")
local tcpGateWC = require("tcpGateWC")
local super = reload("super.basic")

---@class tcpLGateWC : super.basic @网关客户端类
local this = class(super)

function this:ctor(name, ip, port)
    super.ctor(self)
    self._name = name
    self._ip = ip
    self._port = port
end

function this:hand()
    return function (hand)
        self._hand = hand
    end
end

function this:launch()
    self._id = tcpGateWC.link(self._name, self._ip, self._port, self)
    return self:hand()
end

---连接消息
function this:accept()
    local hand = self._hand
    hand.accept()
end

function this:forward_add(map)
    tcpGateWC.forward_add(self._name, map)
end

function this:forward_del(map)
    tcpGateWC.forward_del(self._name, map)
end

function this:forward_cls()
    tcpGateWC.forward_cls(self._name)
end

return this
